package com.bourse.core.ibatis;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.bourse.core.services.utils.MailingData;
import com.ibatis.sqlmap.client.SqlMapClient;

public class MailingIbatisDao implements MailingDao {

	private final Logger LOGGER = Logger.getLogger(MailingIbatisDao.class);
	
	private SqlMapClient sqlMapClient;

	@SuppressWarnings("unchecked")
	public List<MailingData> getMailingData(){
		
		List<MailingData> mailingData = new ArrayList<MailingData>();
		try{
			mailingData = sqlMapClient.queryForList("GET_MAILING");
		}catch(SQLException e){
			LOGGER.error("[MailingService] - Imposible to get data from database " +e.getMessage());
		}
		return mailingData;
	}
		
	/**
	 * @param sqlMapClient the sqlMapClient to set
	 */
	public void setSqlMapClient(SqlMapClient sqlMapClient) {
		this.sqlMapClient = sqlMapClient;
	}
	
	
	
}
